home *** CD-ROM | disk | FTP | other *** search
/ Champak 140 / (Vol 140) Sep 19 2011.iso / Games / theLifeArk.swf / scripts / __Packages / prop / plug.as < prev    next >
Encoding:
Text File  |  2011-09-19  |  1.7 KB  |  79 lines

  1. class prop.plug extends MovieClip
  2. {
  3.    var runSta;
  4.    var aniType;
  5.    var onEnterFrame;
  6.    function plug()
  7.    {
  8.       super();
  9.       this.runSta = "rest";
  10.       this.aniType = "none";
  11.       this.setOEF(true);
  12.    }
  13.    function setOEF(p)
  14.    {
  15.       if(p)
  16.       {
  17.          this.onEnterFrame = this.OEF;
  18.       }
  19.       else
  20.       {
  21.          this.onEnterFrame = null;
  22.       }
  23.    }
  24.    function setAni(p)
  25.    {
  26.       switch(this.aniType)
  27.       {
  28.          case "none":
  29.             this._visible = true;
  30.             this.runSta = p[0];
  31.             this.aniType = p[1];
  32.             break;
  33.          case "charge":
  34.             this.runSta = p[0];
  35.             this.aniType = p[1];
  36.             this._parent.cloud.setChargeOver();
  37.       }
  38.    }
  39.    function OEF()
  40.    {
  41.       var _loc0_ = null;
  42.       if((_loc0_ = this.runSta) === "play")
  43.       {
  44.          this.playAni();
  45.       }
  46.    }
  47.    function playAni()
  48.    {
  49.       _global.ctn.sndCtrl.playSound("snd_plugInOff");
  50.       switch(this.aniType)
  51.       {
  52.          case "extend":
  53.             if(this._currentframe < 73)
  54.             {
  55.                this.nextFrame();
  56.             }
  57.             else
  58.             {
  59.                this._parent.cloud.ctt.gotoAndStop("charging");
  60.                this.runSta = "charge";
  61.                this.aniType = "none";
  62.             }
  63.             break;
  64.          case "shorten":
  65.             if(this._currentframe > 1)
  66.             {
  67.                this.prevFrame();
  68.             }
  69.             else
  70.             {
  71.                this._parent.cloud.setChargeOver();
  72.                this.runSta = "rest";
  73.                this.aniType = "none";
  74.                this._visible = false;
  75.             }
  76.       }
  77.    }
  78. }
  79.